<template>
	<view class="bi-round-button" :class="['bi-round-button--' + type, { 'is-disabled': disabled }]" @click="handleClick">
		<slot></slot>
	</view>
</template>

<script>
export default {
	name: 'BiRoundButton',
	props: {
		type: {
			type: String,
			default: 'default',
			validator (value) {
				return ['success', 'primary', 'default'].includes(value)
			}
		},
		disabled: {
			type: Boolean,
			default: false
		}
	},
	methods: {
		handleClick () {
			if (this.disabled) {
				return
			}
			this.$emit('click')
		}
	}
}
</script>

<style lang="less">
.bi-round-button{
	width: 24px;
	height: 24px;
	line-height: 24px;
	text-align: center;
	border-radius: 50%;
	&.is-disabled {
		background-color: #ccc;
	}
}
.bi-round-button--success{
	background-color: #6dc873;
	color: #fff;
}
.bi-round-button--primary{
	background-color: #414050;
	color: #fff;
}
</style>